<?php
namespace app\admin\controller;

use app\admin\model\User;
use app\common\Auth\JwtAuth;

/**
 * @title 登录以及退出登录
 * Class Passport
 * @package app\admin\controller
 */
class Passport extends BaseController
{
    public function login($user_id = 1)
    {
        $userModel = new User();
        $user = $userModel->where("user_id", "=", $user_id)->find();
        $jwt = JwtAuth::getInstance();
        $jwt->setUid($user_id);
        $token = $jwt->getToken();
        return $this->renderSuccess(["token" => $token,
        ]);
    }
}